package com.chen.project.white_jotter.config;

import com.chen.project.white_jotter.mapper.JotterArticleMapper;
import com.chen.project.white_jotter.utils.RedisUtil;
import org.springframework.boot.CommandLineRunner;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Set;

@Component
public class CommandLineRunnerImpl implements CommandLineRunner {

    @Resource
    private SiteProps siteProps;
    @Resource
    private RedisUtil redisUtil;

    @Resource
    private JotterArticleMapper jotterArticleMapper;
    @Resource
    private ElasticsearchRestTemplate esTemplate;

    @Override
    public void run(String... args) throws Exception {

        System.out.println("项目重启，清空redis缓存");
        Set<String> keys = redisUtil.keys("*");
        redisUtil.delete(keys);

        System.out.println(siteProps.getOsType());
        System.out.println(siteProps.getFilePath());
    }
}
